//
//  PhotoCollection.h
//  Memento 2.0
//
//  Created by Chris Maddocks on 10-06-27.
//  Copyright 2010 Team Memento. All rights reserved.
//
//  Description: Manages a collection of memories, and retains a "cursor" pointer to the current memory.
//  PhotoCollection helps calling code browse between memories without needing to check for BOF/EOF conditions.
//  It uses synthesized properties, so the current memory can also be observed using key-value observing.
//
//  10-08-02: Add functions for clearing collection, deleting memories, and initiailizing from an existing Memory  (C. Maddocks)
//	10-08-02: Make keys consistent between initWithDictionary: and NSCoding implementation  (C. Maddocks)
//  10-07-21: Bump version in header to 2.0.  (C. Maddocks)


#import <Foundation/Foundation.h>
#import "Memory.h"

#define kSortByDate 0
#define kSortByLocation 1
 
@class Memory;


@interface PhotoCollection : NSObject <NSCoding> {
	NSMutableArray *memoryData;				// ordered by date-time
	NSMutableArray *memoryDataByLocation;	// ordered by distance from current location - FUTURE
	
	int currentIndex;			// which index in memoryData we are currently viewing
	Memory *currentMemory;		// memory at currentIndex
	
	int nextMemoryId;			// for next memory we add to photo collection	
}
- (void)moveFirst;
- (BOOL)movePrev;
- (BOOL)moveNext;
- (void)moveLast;
- (void)sortBy:(int)sortMethod;  //input: either SORT_BY_DISTANCE or SORT_BY_DATETIME.  For future development.
- (int)count;

- (void)deleteCurrentMemory;
- (void)clearCollection;

- (void)addMemoryWithContentsOfDictionary:(NSDictionary *)aDictionary;	
- (void)addMemory:(Memory *)memory;
- (Memory *)generateMemoryWithImage:(UIImage *)aImage location:(CLLocationCoordinate2D)aLocation;			// creates a new memory, adds it to the collection, and repositions the cursor.

- (NSString *)collectionDataPath;	// currently, points to the user's documents folder root.  In future could be expanded to support
									// multiple photo colletions.

- (id)init;											// Initialize an empty PhotoCollection.

- (void)dealloc;


@property IBOutlet (nonatomic, retain) Memory *currentMemory;
@property (nonatomic) int currentIndex; 
@property (nonatomic, readonly) int nextMemoryId;

@end
